<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="stylesheet/less" type="text/css" href="css/t3Html.less">

    <script src="lessLib/less-1.7.0.min.js" type="text/javascript"></script>
    <title></title>
</head>
<body>
<!--等待层开始-->
<div class="wait_gear" style="display: none;">
    <div class="logo"></div>
    <div class="gear"></div>
    <div class="loading_content"></div>
</div>
<!--等待层结束-->
<!--登陆页面开始-->
<div class="main-page" id="subloginPage"
     data-belongToMenu="none"
     data-belongtoheader='{"back":false,"search":false,"scancode":false,"add":false}'
     data-title="餐云">
    <div class="cont">
        <div class="logo"></div>
        <input class="nameText" type="text" placeholder="帐号">
        <input class="pwdText" type="password" placeholder="密码">
        <div class="loginBtn" data-function="loginSystem">登录</div>
        <p class="remind" >登录遇到问题请联系相关部门</p>

    </div>
</div>
<!--登陆页面结束-->
<script src="jsLib/jquery-2.1.3.min.js"></script>
<script src="../../jsLib/jquery/jquery.json.js"></script>
<script src="../../jsLib/jquery/jquery.ajaxRequest.js"></script>
<script src="../../jsLib/jquery/ajaxfileupload.js"></script>
<script src="../../jsLib/interface.js"></script>
<script>
    var waitPage = {
        closeflag:null,
        /*显示等待时间*/showWaitTime : function(){
            $(".wait_gear").fadeIn(100);
            var i=0;
            this.closeflag= setInterval(function(){
                i++;
                if(i==1){
                    $('.gear').css('background-position','0 -104px')
                }else if(i==2){
                    $('.gear').css('background-position','0 -181px')

                }else if(i==3){
                    $('.gear').css('background-position','0 -250px')
                    i=0;
                }else if(i==4){
                    $('.gear').css('background-position','0 -316px')
                    i=0;
                }

            },100)
        },
        /*关闭等待时间*/closeWaitTime :function(){
            $(".wait_gear").fadeOut(100);
            clearInterval(this.closeflag);
        }
    }
   $('.loginBtn').click(function(){
       waitPage.showWaitTime();//显示等待页面
       var user = $.trim($("#subloginPage .nameText").val());
       var pwd = $.trim($("#subloginPage .pwdText").val());
       OrderingSystem.signIn(user, pwd, function (data) {
           waitPage.closeWaitTime()//关闭等待页面
           if(data.error>0){
               alert('用户名或者密码错误')
           }else{


               var now = new Date();
               now.setDate(now.getDate() + 2);
                      localStorage.setItem("bqcuser_name",data.data[0].username)
                localStorage.setItem("bqcuser_PIN",data.data[0].pin)
//               document.cookie =  "bqcuser_name=" + data.data[0].username + ";expires=" + now.toString() + ";path=/";
//               document.cookie= "bqcuser_PIN=" + data.data[0].pin + ";expires=" + now.toString() + ";path=/";
               window.location.href = "serverPhone.html";
           }

       });
   })
</script>
</body>
</html>